package work;

import book.Booklist;


public class Delbook implements Iwork{
    public void work(Booklist booklist){
        int pos=Input.input(booklist);
        int size=booklist.getBooklistsize();
            if (pos >= 0) {
                System.out.println(booklist.getBook(pos));
                System.out.println("确定要删除该书吗，确定输入1,取消输入0");
                int input=scanner.nextInt();
                if(input==1) {
                    for (int i = pos + 1; i < size; i++) {
                        booklist.setBook(booklist.getBook(i), i - 1);
                    }
                    booklist.setBooklistsize(size - 1);
                    System.out.println("删除成功");
                }else{
                    System.out.println("你取消了删除");
                }
            }
    }
}
